CREATE TABLE [dbo].[TTAMAR_OPAN]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[CO_UNID_CONC] [dbo].[TD_VC_003] NOT NULL,
[NU_AMAR] [dbo].[TD_VC_008] NOT NULL,
[FE_AMAR] [dbo].[TD_DT_001] NOT NULL,
[CO_TIPO_OPER] [dbo].[TD_VC_003] NOT NULL,
[FE_ANUL] [dbo].[TD_DT_001] NOT NULL,
[ST_CONT] [dbo].[TD_VC_001_INTE] NOT NULL CONSTRAINT [DF__TTAMAR_OP__ST_CO__5EE9FC26] DEFAULT ('N'),
[NU_PROC] [dbo].[TD_IN_001] NULL CONSTRAINT [DF__TTAMAR_OP__NU_PR__60D24498] DEFAULT ((0)),
[NU_ASTO] [dbo].[TD_VC_010] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TTAMAR_OP__CO_US__61C668D1] DEFAULT (suser_sname()),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTAMAR_OP__FE_US__62BA8D0A] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TTAMAR_OP__CO_US__63AEB143] DEFAULT (suser_sname()),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTAMAR_OP__FE_US__64A2D57C] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTAMAR_OPAN] WITH NOCHECK ADD CONSTRAINT [CK__TTAMAR_OP__ST_CO__5FDE205F] CHECK NOT FOR REPLICATION (([ST_CONT]='P' OR [ST_CONT]='N'))
GO
ALTER TABLE [dbo].[TTAMAR_OPAN] ADD CONSTRAINT [PK__TTAMAR_O__DA2E927F4AB8E647] PRIMARY KEY CLUSTERED  ([CO_EMPR], [CO_UNID_CONC], [NU_AMAR], [FE_AMAR]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTAMAR_OPAN] ADD CONSTRAINT [FK__TTAMAR_OPAN__35DDC4F2] FOREIGN KEY ([CO_EMPR], [CO_TIPO_OPER]) REFERENCES [dbo].[TTTIPO_OPER] ([CO_EMPR], [CO_TIPO_OPER])
GO
ALTER TABLE [dbo].[TTAMAR_OPAN] ADD CONSTRAINT [FK__TTAMAR_OPAN__36D1E92B] FOREIGN KEY ([CO_EMPR], [CO_UNID_CONC], [NU_AMAR], [FE_AMAR]) REFERENCES [dbo].[TCAMAR_OCPR] ([CO_EMPR], [CO_UNID_CONC], [NU_AMAR], [FE_AMAR])
GO
